<template>
  <div style="margin-bottom: 70px;">
      <van-nav-bar class="app-nav-bar" title="事件详情页" left-arrow @click-left="back"/>
        <van-cell class="mb-4" title="事情内容" :value="tableData.qualityContent" />
        <van-cell class="mb-4" title="当前状态:">
            <template #default>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '0'">待派发</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '1'">处理中</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '2'">已处理</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '3'">已结束</span>
                <span style="margin-left:10px" v-if="tableData.eventStatus === '4'">驳回</span>
            </template>
        </van-cell>
        <van-cell class="mb-4" title="上报位置:" :value="tableData.reportingLocation" />
        <van-cell class="mb-4" title="部件:" :value="tableData.partsName" />
        <van-cell class="mb-4" title="部件负责人:" :value="tableData.leader" />
        <van-cell class="mb-4" title="上报人:" :value="tableData.reportPerson" />
        <van-cell class="mb-4" title="上报时间:" :value="tableData.reportTime" />
        <van-cell class="mb-4" title="派发类型:" :value="tableData.distributeType" />
        <van-cell class="mb-4" title="派发时间:" :value="tableData.distributionTime" />
        <van-cell class="mb-4" title="事件描述:" :value="tableData.eventDesc" />
        <van-cell class="mb-4" title="处理人:" :value="tableData.handlerPerson" />
        <van-cell class="mb-4" title="处理时间:" :value="tableData.handlerTime" />
        <van-cell class="mb-4" title="处理时长" :value="tableData.handlerDuration" />
        <van-cell class="mb-4" title="扣分" :value="tableData.deductPoints" />
        <van-cell class="mb-4" title="片区负责人:" :value="tableData.distributePerson" />
        <van-cell class="mb-4" title="转单人:" :value="tableData.transferPerson" />
        <van-cell class="mb-4" title="转单时间:" :value="tableData.transferTime" />
        <van-cell class="mb-4" title="驳回描述" :value="tableData.rejectDesc" />
        <van-cell class="mb-4" title="照片">
            <template #default>
                <img :src="photo" alt="">
            </template>
            <!-- <van-image width="100" height="100" :src="photo"/> -->
            </van-cell>
        <van-cell class="mb-4" title="已处理照片">
            <template #default>
                <img :src="handlerPhoto" alt="">
            </template>
            <!-- <van-image width="100" height="100" :src="handlerPhoto"/> -->
        </van-cell>
        <van-cell style="text-align: center;" title-class="btn">
            <template #title>
                <van-button plain type="info" @click="qr">确认处理</van-button>
                <van-button style="margin-left: 30px;" plain type="info" @click="cd">转单</van-button>
            </template>
        </van-cell>
  </div>
</template>

<script>
export default {
data(){
        return{
            tableData:[],
            photo:undefined,
            handlerPhoto:undefined
        }
    },
    methods:{
        qr(){
            this.$router.push({name: 'qr', params: { id: this.$route.params.id}})
        },
        cd(){
            this.$router.push("/cd/"+this.$route.params.id+"/"+this.tableData.districtId)
        },
        back(){
            this.$router.go(-1) 
        },
        async getUser(){
            var {data:res} =await this.request.get('/app/Event/getEventById?id='+this.$route.params.id)
            console.log(res);
            this.tableData=res.data;
            this.photo=this.$location.getPhoto+'?id='+this.$route.params.id+"&width=100&height=100"
            this.handlerPhoto=this.$location.getHandlerPhoto+'?id='+this.$route.params.id+"&width=100&height=100"
        },
    },created(){
        this.getUser();
    }
}
</script>

<style>

</style>